
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：1.编码问题.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-19 10:27
'''

str_code = "中文"
print(type(str_code))

byte_code = str_code.encode("gbk")
print(type(byte_code))
## 编解码保持一致
# print(byte_code.decode("utf-8"))

byte_code = b'123'
print(type(byte_code))
str_code = byte_code.decode()
print(type(str_code))